Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inherit Qt UI design from .ui files #6

Draft
wants to merge 31 commits into
base: master
Choose a base branch
from

Conversation

benjaminhwilliams
Copy link
Member

@benjaminhwilliams benjaminhwilliams commented Nov 20, 2020

Rather than hard-coding the UI design in Python, use .ui files design files, which can be edited in design editors such as Qt Designer. This allows us to make changes in future to the UI without having to keep track of reams of Python code. The .ui files are simply imported with PyQt5.uic.loadUi, to inherit the structure and basic behaviour of the widgets. One then need only connect the appropriate signals and slots to methods and functions in Python.

Closes #4.

Make sure that we remove the exit button from the log output tab,
regardless of its position in the tab bar.
These previously changed in the OptionsWindow.ui design file.
Simplify the code by removing the corresponding hard-coded definitions.
Add a caption to the dialogue widget and the filter selector.
Default to the location of any previously selected instrument model
file.
Don't unset the reference instrument model file selection if the
dialogue widget is cancelled.
Remove redundant setScaledContents calls.
Remove a setText from UIOptionsWindow.browse_for_reference_model because
it is now redundant.
Also tidy up the wording of some widget labels.
@lgtm-com

This comment has been minimized.

Also correct some usages of a renamed attribute.
Serialise saved options to a JSON file.  Options to be saved are
determined by searching all the attributes of a UIOptionsWindow
instance.  If the type of an attribute matches a list of recognised
user-input widget types, then we record the value of a specific
pre-determined property of each widget.  For now, the recognised
user-input widget types are QCheckBox, QComboBox and QLineEdit, with the
corresponding properties 'checked', 'currentIndex' and 'text' recorded.
Use QtCore.QObject.tr instead of QtCore.QCoreApplication.translate.
Translate all user-facing strings.  Rationalise some capitalisation.
Also make it so that a UIOptionsWindow without a parent falls back to
logging with a simple print call.
@lgtm-com
Copy link

lgtm-com bot commented Dec 4, 2020

This pull request introduces 1 alert when merging d38e701 into da99620 - view on LGTM.com

new alerts:

  • 1 for Wrong number of arguments in a class instantiation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant